home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / TBEXPERT.PAK / GMPLACE.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  85 lines

  1. //----------------------------------------------------------------------------
  2. // Copyright (c) 1995, 1995 by Borland International, All Rights Reserved
  3. //
  4. // Filename:    gmplace.cpp
  5. //
  6. // Date:        Sep 28, 1995
  7. //
  8. // Description:
  9. //----------------------------------------------------------------------------
  10. #include <owl/pch.h>
  11. #include "TBExpert.h"
  12.  
  13. TGadgetManagerPlaceHolder::TGadgetManagerPlaceHolder(TWindow* parent)
  14. :
  15.   TLayoutWindow(parent, 0)
  16. {
  17.   Manager = 0;
  18.   Attr.Style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
  19.   Attr.ExStyle |= WS_EX_CLIENTEDGE;
  20. }
  21.  
  22. TGadgetManagerPlaceHolder::~TGadgetManagerPlaceHolder()
  23. {
  24. }
  25.  
  26. void
  27. TGadgetManagerPlaceHolder::SetupWindow()
  28. {
  29.   TLayoutWindow::SetupWindow();
  30.   CreateGadgetManager();
  31. }
  32.  
  33. bool
  34. TGadgetManagerPlaceHolder::EvEraseBkgnd(HDC)
  35. {
  36.   return true;
  37. }
  38.  
  39. DEFINE_RESPONSE_TABLE1(TGadgetManagerPlaceHolder, TLayoutWindow)
  40. //  EV_WM_ERASEBKGND,
  41. END_RESPONSE_TABLE;
  42.  
  43. void
  44. TGadgetManagerPlaceHolder::CreateGadgetManager()
  45. {
  46.   DeleteGadgetManager();
  47.   Manager = new TGadgetManager(this);
  48.   TLayoutMetrics lmManager;
  49.   lmManager.X.SameAs(lmParent, lmLeft);
  50.   lmManager.Y.SameAs(lmParent, lmTop);
  51.   lmManager.Width.SameAs(lmParent, lmRight);
  52.   lmManager.Height.SameAs(lmParent, lmBottom);
  53.   SetChildLayoutMetrics(*Manager, lmManager);
  54.   if (IsWindow()) {
  55.     Manager->Create();
  56.     Layout();
  57.   }
  58. }
  59.  
  60. void
  61. TGadgetManagerPlaceHolder::DeleteGadgetManager()
  62. {
  63.   delete Manager;
  64.   Manager = 0;
  65. }
  66.  
  67.  
  68. TResult
  69. TGadgetManagerPlaceHolder::EvCommand(uint id, THandle hWndCtl, uint notifyCode)
  70. {
  71.   if (DummyGadgetIdBase <= id && id < DummyGadgetIdBase + MaxGadgetFactories)
  72.     return 0;
  73.   return TLayoutWindow::EvCommand(id, hWndCtl, notifyCode);
  74. }
  75.  
  76. void
  77. TGadgetManagerPlaceHolder::EvCommandEnable(TCommandEnabler& ce)
  78. {
  79.   if (DummyGadgetIdBase <= ce.GetId() && ce.GetId() < DummyGadgetIdBase + MaxGadgetFactories)
  80.     ce.Enable(true);
  81.   else
  82.     TLayoutWindow::EvCommandEnable(ce);
  83. }
  84.  
  85.